package com.dog.basics.admin.controller.common;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.dog.basics.bean.dto.admin.common.UserChangeMobileFromDto;
import com.dog.basics.bean.vo.admin.common.UserChangeMobileVo;
import com.dog.basics.common.constant.SwaggerConstants;
import com.dog.basics.common.util.PageParam;
import com.dog.basics.common.util.R;
import com.dog.basics.service.common.IDogUserChangeMobileService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 用户手机修改变动变 前端控制器
 * </p>
 *
 * @author wph
 * @since 2020-05-27
 */
@RestController
@Api(value = SwaggerConstants.COMMON+"用户手机修改变动", tags = SwaggerConstants.COMMON+"用户手机修改变动")
@RequestMapping("/admin/change/mobile")
@AllArgsConstructor
public class DogUserChangeMobileController {

    private final IDogUserChangeMobileService dogUserChangeMobileService;

    /**
     * @功能描述: 用户手机修改变动列表
     * @author He
     * @date 2020/5/22
     */
    @ApiOperation(value = "用户手机修改变动列表", notes = "用户手机修改变动列表(admin:changeMobile:page)")
    @PreAuthorize("@pms.hasPermission('admin:changeMobile:page')")
    @GetMapping("/page")
    public R<IPage<UserChangeMobileVo>> getUserChangeMobilePage(PageParam page, UserChangeMobileFromDto dto) {
        return R.ok(dogUserChangeMobileService.getPageList(page, dto));
    }


    /**
     * @功能描述: 删除用户手机修改变动
     * @author He
     * @date 2020/5/22
     */
    @ApiOperation(value = "删除用户手机修改变动", notes = "删除用户手机修改变动 (admin:changeMobile:del)")
    @ApiImplicitParam(name = "ids", value = "主键标识", dataType = "List<Long>", required = true)
    @PreAuthorize("@pms.hasPermission('admin:changeMobile:del')")
    @DeleteMapping
    public R<Boolean> delUserChangeMobile(@RequestBody List<Long> ids) {
        return R.ok(dogUserChangeMobileService.deleteObj(ids));
    }


}
